This section discusses the Movie Toolbox functions your application can use to create and dispose of time bases.
The NewTimeBase function lets you create a new time base. You can use the DisposeTimeBase function to dispose of a time base once you are finished with it.
Time bases rely on either a clock component or another time base for their time source. You can use the SetTimeBaseMasterTimeBase function to cause one time base to be based on another time base. The GetTimeBaseMasterTimeBase allows you to determine the master time base of a given time base.
You can assign a clock component to a time base; that clock then acts as the master clock for the time base. You can use the SetTimeBaseMasterClock function to assign a clock component to a time base. The GetTimeBaseMasterClock function enables you to determine the clock component that is assigned to a time base. You can change the offset between a time base and its time source by calling the SetTimeBaseZero function.
You can set the time source of a movie by calling the SetMovieMasterTimeBase and SetMovieMasterClock functions.
Note
Although most time base functions can be used at interrupt time, several of the Movie Toolbox functions cannot. These functions are noted in the sections that follow.
The NewTimeBase function allows your application to obtain a new time base. This function returns a reference to the new time base. Your application must use that reference with other time base functions.
pascal TimeBase NewTimeBase (void);
The NewTimeBase function returns a reference to the new time base.
This function sets the rate of the time base to 0, the start time to its minimum value, the time value to 0, and the stop time to its maximum value.
This function assigns the default clock component to the new time base. If you want to assign a different clock component or a master time base to the new time base, use the SetTimeBaseMasterClock or SetTimeBaseMasterTimeBase functions, which are described on SetTimeBaseMasterClock and SetTimeBaseMasterTimeBase , respectively.
The DisposeTimeBase function allows your application to dispose of a time base once you are finished with it.
pascal void DisposeTimeBase (TimeBase tb);
The DisposeTimeBase function cancels and disposes of any pending callback events that are associated with the time base.
You can use the SetMovieMasterClock function to assign a clock component to a movie. Do not use the SetTimeBaseMasterClock function to assign a clock component to a movie.
pascal void SetMovieMasterClock (Movie theMovie,
Component clockMeister,
const TimeRecord *slaveZero);
You can use the SetMovieMasterTimeBase function to assign a master time base to a movie. Do not use the SetTimeBaseMasterTimeBase function (described on SetTimeBaseMasterTimeBase ) to assign a time base to a movie.
pascal void SetMovieMasterTimeBase (Movie theMovie, TimeBase tb,
const TimeRecord *slaveZero);
You can use the SetTimeBaseMasterClock function to assign a clock component to a time base. A time base derives its time from either a clock component or from another time base. Do not use this function to assign a clock to a movie's time base.
pascal void SetTimeBaseMasterClock (TimeBase slave,
Component clockMeister,
const TimeRecord *slaveZero);
You can use the GetTimeBaseMasterClock function to determine the clock component that is assigned to a time base. A time base derives its time from either a clock component or from another time base. If a time base derives its time from a clock component, you can use this function to obtain the component instance of the clock component.
pascal ComponentInstance GetTimeBaseMasterClock (TimeBase tb);
The GetTimeBaseMasterClock function returns a reference to a component instance of the clock component that provides a time source to this time base.
Note
The Component Manager allows a single component to serve multiple client applications at the same time. Each client application has a unique access path to the component. These access paths are called
connections.
You identify a component connection by specifying a
component instance.
The Component Manager provides this component instance to your application when you open a connection to a component. The component maintains separate status information for each open connection.
Do not close this connection--the time base is using the connection to maintain its time source. If a clock component is not assigned to the time base, this function sets the returned reference to nil . In this case, the time base relies on another time base for its time source. Use the GetTimeBaseMasterTimeBase function, which is described on GetTimeBaseMasterTimeBase , to obtain the time base reference to that master time base.
You can use the SetTimeBaseMasterClock function, which is described on SetTimeBaseMasterClock , to assign a clock component to a time base.
You can use the SetTimeBaseMasterTimeBase function to assign a master time base to a time base. A time base derives its time from either a clock component or another time base. Do not use this function to assign a master time base to a movie's time base.
pascal void SetTimeBaseMasterTimeBase (TimeBase slave,
TimeBase master,
const TimeRecord *slaveZero);
You can use the GetTimeBaseMasterTimeBase function to determine the master time base that is assigned to a time base. A time base derives its time from either a clock component or from another time base. If a time base derives its time from another time base, you can use this function to obtain the identifier for that master time base.
pascal TimeBase GetTimeBaseMasterTimeBase (TimeBase tb);
The GetTimeBaseMasterTimeBase function returns a reference to the master time base that provides a time source to this time base. If a master time base is not assigned to the time base, this function sets the returned reference to nil . In this case, the time base relies on a clock component for its time source. Use the GetTimeBaseMasterClock function, which is described on GetTimeBaseMasterClock , to obtain the component instance reference to that clock component.
You can use the SetTimeBaseZero function to change the offset from a time base to either its master time base or its clock component. You establish the initial offset when you assign the time base to its time source.
pascal void SetTimeBaseZero (TimeBase tb, TimeRecord *zero);
You can use the SetTimeBaseMasterClock function (described on SetTimeBaseMasterClock ) to assign a time base to a clock component.
You can use the SetTimeBaseMasterTimeBase function (described on SetTimeBaseMasterTimeBase ) to assign a time base to a master time base.